package com.lollipop.programming;

/**
 * @Author Lollipop
 * @Date 2025/4/7 16:54
 * @Description 斐波那契数列
 */
public class Fibonacci {
    public static void printFibonacciSeries(int n) {
        int a = 0, b = 1;
        System.out.print("斐波那契数列前" + n + "项: ");

        for (int i = 1; i <= n; i++) {
            System.out.print(a + " ");
            int sum = a + b;
            a = b;
            b = sum;
        }
    }

    public static void main(String[] args) {
        int n = 10;
        printFibonacciSeries(n);
    }
}